Stay calm and do not show any reaction to the child's words. If preschoolers learn that certain words get an adult's attention, they may start using them more often to try to get the same reaction.
Explain that the word is not acceptable. Use a gentle but firm voice. Say that those words can hurt people's feelings and are not to be used. If preschoolers have heard their parents use those words, they may respond with "But Mommy says it!" Explain that those words are not allowed in preschool. If other children heard the profanity, give this explanation right away so all the others can hear it as well.
Give alternative words that children can use. For instance, if they used a word as an exclamation of anger, suggest that they say "darn!" or "boo!" instead. It's not enough to tell preschoolers what's wrong. You must teach them what is right for them to do.
Give consequences. If children continue to swear after you have told them to stop, let them know that there will be consequences if they continue. Say "If you use that word again, you'll need to be all done playing in the sand box." You may also warn that the child will need to have a time out if he continues.
Praise children for using good language. A few minutes after a swearing incident, say "I'm glad to hear you using good words now. Keep it up!" Continue praising him for his good word choices throughout the day. This positive reinforcement should make him want to continue to use acceptable language.