We report on scanning tunneling spectroscopy studies of magnesium diboride $({\mathrm{MgB}}_{2})$ thin films grown by different techniques. The films have critical temperatures ranging between 28 and 41 K with very different upper critical fields. We find that the superconducting gap associated with the $\ensuremath{\sigma}$ band decreases almost linearly with decreasing critical temperature while the gap associated with the $\ensuremath{\pi}$ band is only very weakly affected in the range of critical temperatures above 30 K. In the sample with the lowest critical temperature (28 K) we observe a small increase of the $\ensuremath{\pi}$ gap that can only be explained in terms of an increase in the interband scattering. The tunneling data was analyzed in the framework of the two-band model. The magnetic-field-dependent tunneling spectra and the upper critical field measurements of these disordered samples can be consistently explained in terms of an increase of disorder that mostly affects the $\ensuremath{\pi}$ band in samples with reduced critical temperatures.