If they're saying it where you can hear it simply ask 'Why do you say things like that?'. Do it in a quiet, calm voice, not belligerent or confrontational.
They can either state that it's their opinion or, more likely, get flustered. People are rarely called on hurtful comments.
If it's being done behind your back you need to reassess you definition of who your friends are.