If I know a songs in say, Ab, then I know which notes are diatonic, and can play those. It's easier for me to memorize a melody aurally, then translate that into notes. If it's a higher pitch, I play a higher scale degree.
Another thing I remember is the motif, which is a fancy word for riff. Songs usually repeat the same musical idea, so if I memorize that, then I can usually remember the rest of the song.
That's just how I do it. Play it enough, and it becomes second nature, until then, I use the music.
I'm interested to hear how other's go about this