The purpose of this work is to understand the effect of an external environment on the adiabatic dynamics of a quantum critical system. By means of scaling arguments we derive a general expression for the density of excitations produced in the quench as a function of its velocity and of the temperature of the bath. We corroborate the scaling analysis by explicitly solving the case of a one-dimensional quantum Ising model coupled to an Ohmic bath.