They tested a bunch of methods for removing earworms. The best turned out to be doing simple math problems in your head. It is theorized that earworms result from brain inactivity-- it starts idling. Doing simple math problems will get it out of idle and the earworm goes away. Keeping it away might require a ball peen hammer.
I've always found that singing ELO's "I can't get it out of my head" works for me.
BTW: If you're looking for a catchy earworm:
When Angus was in grade school, he learned it, and used to sing it incessantly.