L.J.
Have you tried just ignoring the behavior? The F word was making its way around my son's preschool a couple months ago. Ignoring it when I heard it actually did make the word go away.
Oh, yeah, I forgot to mention. Like a lot of things with kids, if you start ignoring his bad behavior, things will get worse before they get better. At first, he will rebel and act worse, but hold your ground. Don't give in and acknowledge his bad behavior! That will just affirm to him that he has the power.
Also, be on the lookout for times when he is using his words appropriately, and give him positive attention when that happens. The positive attention does not have to be word related, and it's better that it isn't. Like you don't have to compliment him for using his words right by saying, "I like it when you use nice words" or something like that. We don't necessarily want children to make good choices because that's what we like at parents. It's much better if the child sincerely WANTS to make good choices on his own from his own heart and mind. It would be even more effective to stop and play with him a little or engage with him in some other way.
If you do this, and he starts testing you by throwing in a cuss, stop playing with him immediately, calmly tell him something like, "No thank you" or "I don't play with children who cuss," and walk away. He will probably freak out and throw a fit that you can pretty much ignore (unless it gets dangerous, in which case, put him in safe place without a word), but he will get over it and eventually lose interest in cussing.
Also, be fair. It you slip and say a dirty word, your son will have every right to say, "No thank you, Mommy!" and walk away from you. That sort of thing has happened to me before. Fair is fair!
It may help to give some thought to why he is doing this. At 2, normal kids (and your son sounds normal), are trying to figure out where their personal power ends and where everyone else's begins. So many of the things that get done in the life of a two year old are out of his control and not by his choice or his design. At the same time, he is getting smart enough to see that other people have influence. So he is just trying to see what his limits are and how those limits are determined.
Children come into this world knowing literally next to nothing. There is so much to figure out. For instance, in a world full of things, what makes a toy yours, but not mine? What's wrong with mugging another child if they have a toy that I want to play with? Why are some words fine to say and others not? Invariably children answer these questions by testing. This is the job description of every child. He's going to test you, stick to your guns.
I hope this helps. Hang in there, Mommy! Age 2 is really tough, but life will get better and easier as your son matures. You will also learn and grow as a mom too!