Dear Gini,
Sometimes the willful behavior of a two-year-old is best handled by paying it no particular attention and refusing to engage in battles or power struggles around it. But it depends on the behavior in question.
In this instance, I would suggest taking a firm stance, and executing this not so much by talking with your son, but by implementing an immediate, automatic five-minute time out on the occasion of any foul language. I say this because such language will bring on a negative response in the social world (different, for example, form silly talk or so-called 'bathroom talk' that some toddlers display).
For the time out, use an adult-size chair, and utilize a portable timer to track the time. Start the timer only when your son is in the chair and quiet. At the conclusion of the time-out period,
simplySimply sleep say "No cursing/swearing/foul language" (whatever term you use with him).