This was an old episode for the new back-then series for the Twilight Zone in the 80’s..
In the “future”, a machine removes the bad memories and you can BUY someone’s great memories. The punch -line was that the lead character was addicted to other people’s great memories (like a celeb having sex with another hot celeb) and he eventually forgot who he really was..
There was a removal of memory genre movie... don’t recall the name, but the story revolved around a couple that would break up, and one, I forget which, solicited the services of a memory removal company to remove the memory of the other partner... forget which, girl or guy, maybe both, that removed the memory of the other.
Eternal Sunshine of the Spotless Mind, 2004, Jim Carrey and Kate Winslet.