Gamma-ray burst (GRB) progenitors are observationally linked to the death of massive stars. X-ray studies of the GRB afterglows can deepen our knowledge of the ionization status and metal abundances of the matter in the GRB environment. Moreover, the presence of local matter can be inferred through its fingerprints in the X-ray spectrum, i.e. the presence of absorption higher than the Galactic value. A few studies based on BeppoSAX and XMM-Newton found evidence of higher than Galactic values for the column density in a number of GRB afterglows. Here we report on a systematic analysis of 17 GRBs observed by Swift up to April 15, 2005. We observed a large number of GRBs with an excess of column density. Our sample, together with previous determinations of the intrinsic column densities for GRBs with known redshift, provides evidence for a distribution of absorption consistent with that predicted for randomly occurring GRB within molecular clouds.