Your statement is contradictory. They can't search for any reason, there must be a probable cause. And it's also not true that everytime you are pulled over, they can search your car. There still must have probable cause, and it must be related to the reason you were pulled over. For example, if you get pulled over for a speeding ticket, they don't start a full-scale drug search. Now, they might use a drug dog, and attempt to determine that from an outside examination, but otherwise you will have to give permission for them to do the search. You can refuse and they can decide to or not, but then they might violate your rights, which opens them up for a lawsuit or case dismissal. There are other factors involved, like things that are in 'plain view' of the officer that you have to take into account, but they can not search at will.
Also, another poster mentioned arrest before they can search your car. You should know that it's possible that you can be taken into custody without formal arrest or even charged with a crime, and that the cops do not have to tell you the charge at the time you are taken into custody or even read your Miranda rights at that time (yep, TV is not like real life!) They can wait until you're booked to do all of that. Sometimes, they can push it, and charge you with something like loitering, trespassing, resisting arrest, etc. so they can search you, but then when you get to the station, these charges are suddenly 'dropped'. You can fight these, but most people won't bother.