We propose a new analysis of small scale CMB data by introducing the cosmological dependency of the foreground signals, focusing first on the thermal Sunyaev-Zeldovich (tSZ) power spectrum, derived from the halo model. We analyse the latest observations by the South Pole Telescope (SPT) of the high-$ell$ power (cross) spectra at 90, 150 and 220 GHz, as the sum of CMB and tSZ signals, both depending on cosmological parameters, and remaining contaminants. In order to perform faster analyses, we propose a new tSZ modelling based on machine learning algorithms (namely Random Forest). We show that the additional information contained in the tSZ power spectrum tightens constraints on cosmological and tSZ scaling relation parameters. We combine for the first time the Planck tSZ data with SPT high-$ell$ to derive even stronger constraints. Finally, we show how the amplitude of the remaining kSZ power spectrum varies depending on the assumptions made on both tSZ and cosmological parameters.