I think it is very important to be aware of your child's developmental level and comfort level. A child usually goes through a phase where they are embarrassed being seen with their parents by their peers in certain circumstances where their independence is important. For example, in a school setting, by about 6th or 7th grade, a child decides that their parents should hang back and let them have some freedom. This is developmentally appropriate as long as it is handled in a respectful way toward the parent. Having open communication with your child and coming to an agreement as to what the standard is ahead of time is very important.
I've noticed this with my son this year. He is 15 and actually went a little longer before deciding that he wanted less school appearances from mom and dad. Now the school my children go to is a small private school where everyone knows everyone, and I am on a first name basis with all of his friends and their parents. But, this year he has found the opposite sex somewhat fascinating and his lunch table is mixed gender now where it wasn't in the past. He finally a few months ago told his dad and me that he would rather we didn't go to school to eat lunch with him anymore. We can honor this because it makes sense, he was respectful when asking, and he doesn't mind his parents around at other times.
If my children were to act disrespectful toward me in front of their friends, the soonest possible time I could get them home they would be disciplined with priviledges lost. I disagree with embarrassing them in front of their friends because this puts you on their level and causes further animosity between parent and child. They need to understand that it will not be tolerated. If it continues to happen, I would, and have said in front of friends that their tone of voice is inappropriate, etc.