The cosmological X-ray emission associated to the possible radiative decay of sterile neutrinos is composed by a collection of lines at different energies. For a given mass, each line corresponds to a given redshift. In this work, we cross correlate such line emission with catalogs of galaxies tracing the dark matter distribution at different redshifts. We derive observational prospects by correlating the X-ray sky that will be probed by the eROSITA and Athena missions with current and near future photometric and spectroscopic galaxy surveys. A relevant and unexplored fraction of the parameter space of sterile neutrinos can be probed by this technique.