This is a The SpongeBob Chronicles episode.
Patrick comes from the future with a beard and cane and tells SpongeBob to beware. SpongeBob is scared, but tries to be normal. It's night time, and SpongeBob is worried.... He picks up Gary and takes him back to the shelter because SpongeBob thinks he's better off there. He ends his friendship with Patrick, gives his pineapple to Squidward, gives one last karate chop to Sandy, and quits at the Krusty Krab. Before he moves on, Future Patrick tells him that Future Patrick's prediction was wrong and that he wants SpongeBob to stay at Bikini Bottom.