We present the results of the observations of the (J, K) = (1, 1) and the (J, K) = (2, 2) inversion transitions of the NH 3 molecule toward a large sample of 40 regions with molecular or optical outflows, using the 37 m radio telescope of the Haystack Observatory. We detected NH 3 emission in 27 of the observed regions, which we mapped in 25 of them. Additionally, we searched for the 6 16 −5 23 H 2 O maser line toward six regions, detecting H 2 O maser emission in two of them, HH265 and AFGL 5173. We estimate the physical parameters of the regions mapped in NH 3 and analyze for each particular region the distribution of high density gas and its relationship with the presence of young stellar objects. In particular, we identify the deflecting high-density clump of the HH270/110 jet. We were able to separate the NH 3 emission from the L1641-S3 region into two overlapping clouds, one with signs of strong perturbation, probably associated with the driving source of the CO outflow, and a second, unperturbed clump, which is probably not associated with star formation. We systematically found that the position of the best candidate for the exciting source of the molecular outflow in each region is very close to an NH 3 emission peak. From the global analysis of our data we find that in general the highest values of the line width are obtained for the regions with the highest values of mass and kinetic temperature. We also found a correlation between the nonthermal line width and the bolometric luminosity of the sources, and between the mass of the core and the bolometric luminosity. We confirm with a larger sample of regions the conclusion of Anglada et al. (1997) that the NH 3 line emission is more intense toward molecular outflow sources than toward sources with optical outflow, suggesting a possible evolutionary scheme in which young stellar objects associated with molecular outflows progressively lose their neighboring high-density gas, weakening both the NH 3 emission and the molecular outflow in the process, and making optical jets more easily detectable as the total amount of gas decreases.