Instrumental data are affected by systematic effects that dominate the errors and can be relevant when searching for small signals. This is the case of the K2 mission, a follow up of the Kepler mission, that, after a failure on two reaction wheels, has lost its stability properties rising strongly the systematics in the light curves and reducing its photometric precision. In this work, we have developed a general method to remove time related systematics from a set of light curves, that has been applied to K2 data. The method uses the Principal Component Analysis to retrieve the correlation between the light curves due to the systematics and to remove its effect without knowing any information other than the data itself. We have applied the method to all the K2 campaigns available at the Mikulski Archive for Space Telescopes, and we have tested the effectiveness of the procedure and its capability in preserving the astrophysical signal on a few transits and on eclipsing binaries. One product of this work is the identification of stable sources along the ecliptic plane that can be used as photometric calibrators for the upcoming Atmospheric Remote-sensing Exoplanet Large-survey mission.