With the arrival of the James Webb Space Telescope the search for habitable worlds has entered a transformative era. However, detecting and characterising atmospheres in small rocky exoplanets is challenging even for a frontier mission like JWST. Furthermore, the telescope time is very limited to perform detailed analysis of the even most suitable targets. Hence, knowing which conditions are favourable for (secondary) atmospheres is a necessary step towards characterising atmospheres of rocky exoplanets. Using the Kompot code, a 1D thermal chemical code, we model different atmospheric compositions (e.g. CO2, N2, H2O) and expose them to high energy XUV spectra of various intensities to reflect the history of a star or the distance between the planet and star. We calculate the thermal and chemical structure of these different atmospheres around a model rocky planet, taking into account photochemistry. Based on the Jeans escape, we also determine under what atmospheric and stellar conditions can this model rocky planet retain an atmosphere over evolutionary timescales. For the scenarios where an atmosphere is retained we also determine the boundary abundances of species such as CO2, which accounts for the majority of the cooling in the upper atmosphere. Our models suggest that due to the strong XUV activity of many late type stars, secondary atmospheres might not survive over any significant amount of time.