I don't know where you live, but I have never seen that kind of attitude from a cop and I live in Houston. I have found that as long as I am courteous to them, they are courteous to me, without exception.
Now I am sure there are some jerks out there, but I have never encountered them and the friends that I know that talk about those kinds of encounters all hate cops. Could it be that their attitude is picked up by the cops and reflected in their behavior...I don't know, maybe.
I am sure that most of the attitude is indeed a reflection, but I think a lot of officers get so much negativity that they end up with a bad habit of "copping a 'tude" because they expect to be on the receiving end of one.