If it is "going out of tune" and not just "sounding out of tune" when you fret a note, try lube first. I have experienced this on my 08 LP Studio when I first got it. The problem was fixed with a little Graphite lube in the nut slots. Only a few $. I add new lube with each string change. .
If it sounds in tune when played open but out of tune when fretted then it needs a good set up. Free if you know what your doing. If it is a recent purchase the store you bought it from may do it for free. I know GC will.
On my Epi it sounded out of tune when fretted and went out of tune after each bend. I had to replace the nut and bridge to fix it. Good luck.