  No statistical study of COMs toward a large sample of high-mass protostars
with ALMA has been carried out so far. We aim to study six N-bearing species:
CH$_3$CN, HNCO, NH$_2$CHO, C$_2$H$_5$CN, C$_2$H$_3$CN and CH$_3$NH$_2$ in a
large sample of high-mass protostars. From the ALMAGAL survey, 37 of the most
line-rich hot molecular cores are selected. Next, we fit their spectra and find
column densities and excitation temperatures of the above N-bearing species, in
addition to CH$_3$OH. We (tentatively) detect CH$_3$NH$_2$ in $\sim32%$ of the
sources. We find three groups of species when comparing their excitation
temperatures: hot (NH$_2$CHO; Tex > 250 K), warm (C$_2$H$_3$CN, HN$^{13}$CO and
CH$_{3}^{13}$CN; 100 K < Tex < 250 K) and cold species (CH$_3$OH and
CH$_3$NH$_2$; Tex < 100 K). This temperature segregation reflects the trend
seen in their sublimation temperatures and validates the idea of onion-like
structure of COMs around protostars. Moreover, the molecules studied here show
constant column density ratios across low- and high-mass protostars with
scatter less than a factor $\sim3$ around the mean. The constant column density
ratios point to a common formation environment of COMs or their precursors,
most likely in the pre-stellar ices. The scatter around the mean of the ratios,
although small, varies depending on the species considered. This spread can
either have a physical origin (source structure, line or dust optical depth) or
a chemical one. Formamide is most prone to the physical effects as it is
tracing the closest regions to the protostars, whereas such effects are small
for other species. Assuming that all molecules form in the pre-stellar ices,
the scatter variations could be explained by differences in lifetimes or
physical conditions of the pre-stellar clouds. If the pre-stellar lifetimes are
the main factor, they should be similar for low- and high-mass protostars.
