We study the environment of 23 submillimetre galaxies (SMGs) drawn from the JCMT/AzTEC 1.1mm S/N-limited sample in the COSMOS field, as well as 4 COSMOS SMGs at z_spec>4.5, and 1 at z_spec=2.49, yielding a sample of 28 SMGs. We search for overdensities using the COSMOS photometric redshifts based on over 30 UV-NIR photometric bands, reaching an accuracy of sigma(Delta z/(1+z))=0.0067 (0.0155) at z<3.5 (>3.5). To identify overdensities we apply the Voronoi tessellation analysis, and estimate the overdensity estimator delta_g as a function of distance from the SMG and/or overdensity center. We test and validate our approach via simulations, X-ray detected groups, and spectroscopic verifications using VUDS and zCOSMOS catalogues showing that even with photometric redshifts in COSMOS we can efficiently retrieve overdensities out to z~5. Our results yield that 11/23 (48%) JCMT/AzTEC 1.1mm SMGs occupy overdense environments. Considering the entire JCMT/AzTEC 1.1mm S/N>4 sample, and accounting for the expected fraction of spurious detections, yields that 35-61% of the SMGs in the S/N-limited sample occupy overdense environments. We perform an X-ray stacking analysis in the 0.5-2keV band using a 32 aperture and our SMG positions, and find statistically significant detections. For our z<2 [z>2] subsample we find an average flux of (4.0+/-0.8)x10^{-16} [(1.3+/-0.5)x10^{-16}] erg/s/cm^2 and a corresponding total mass of M_200 = 2.8x10^{13} [2x10^{13}] MSol. Our results suggest a higher occurrence of SMGs occupying overdense environments at z>3, than at z<3. This may be understood if highly star forming galaxies can only be formed in the highest peaks of the density field tracing the most massive dark matter haloes at early cosmic epochs, while at later times cosmic structure may have matured sufficiently that more modest overdensities correspond to sufficiently massive haloes to form SMGs.