Most of the time, they are not done by producers or the directors. Generally basic broadcast TV channels do this. They use a person to re-voice some part whose voice sounds like the original actor or actress.
But sometimes, procucer or director shot an alternative scene as the the censored version. Like in Ghostbusters:
Original Line: "We came, we saw, we kicked it's ass!"
Edited Version: "What a knockabout of pure fun that was."
Perhaps the worst example of Bowdlerisation ever – particularly insulting because the cast actually recorded this alternate version.
In fact there are a bunch of movies which got censorship. I guess the most important one is Snakes on a Plane; Original version and TV censored version
Also there is a collection of some famuos moive censors and a list of 50 strangest censored movie lines
So generally TV channels choose to re-sound the scene with a person who has a similar sound as the original actor/actress. That happens if the producer or director do not make an alternative shot and the TV channel do not want to spend much money for censorship.
Wikipedia have a section about that:
Some films have content deemed "objectionable" to "family audiences": sexual content, obscene language, graphic violence, and perceived racial insensitivities. To make these films suitable for younger or more typical audiences, or to appeal to advertisers when a film is shown on basic cable or broadcast TV, alternative versions are created with such content removed or replaced. Often, profanities are replaced with minced oaths. For example, in the edited version of Pulp Fiction, Samuel L. Jackson uses the minced oath "screw", "little sucker", and "my friend". The editing of these versions is performed by a censor and not the producer or director of the work. Two other examples would be in the edited version of Mrs. Doubtfire, when Daniel Hillard's mask is run over, he screams "Oh!", whereas in the original version, he screams, "Oh shit!" and in the 1987 comedy film, Planes, Trains & Automobiles, where Neal Page is at the Car Rental Agency, and says the "f-word" 18 times and the car rental agent says to him something which is muted out on TV airings. Also, in the edited version of Walt Disney Pictures' Atlantis: The Lost Empire, all parts with Packard smoking cigars were erased, and in the edited version of Walt Disney Pictures' The Parent Trap, the part with Hallie pierces Annie's ears is shorter, whereas in the regular version, the "ear piercing" part is longer. Annie's lines, "Marriage is supposed to be based on something more than just sex, right?" and "Oh my God!" are muted out. Plus, a part in An Extremely Goofy Movie, in which main characters Goofy and Max, as well as Tank, are trapped inside a flaming papier-mache x (symbol of the X-games), was erased when it was shown on the Disney Channel and Toon Disney (now Disney XD).
These films are typically preceded by the disclaimer, "This film has been modified from its original version. It has been formatted to fit this screen and edited for content."
So it depends, sometimes alternative shots, sometimes low-budget TV works.