I have a buddy building a new house and the guys that did the drywall didn't use green board in the bathrooms. We live in Iowa. Is it code to put green board in the bathrooms in Iowa I can't seem to find it if there is.
Yes most town's inspectors will require greenboard. As I have mentioned in other comments this is about 80% in 5-6 states. So more than likely it is a requirement.
And to clarify greenboard cannot be exposed in shower areas except for ceilings and above adult heights (6 feet). Maybe someone can find a real "rule" but this is what 30+ different inspectors have told me. So in most cases we have greenboard everywhere in bathroom except shower - unless it is a prebuilt fiberglass in which you have to have either greenboard or cement board (doesn't work on these well) behind - or nothing.
Does it do anything at all or server any purpose? In almost all cases no. It does offer a little bit more resistance but water is tricky. There are hardly any cases where you are right on the edge of having an issue. Either you messed up and have an issue or you don't. Greenboard might offer an extended period of no mold/water logging from extreme steam plus a poor paint job. But eventually it will fail exactly like regular "white" drywall and the mold and everything will be the same spots.
The key to a mold free, maintenance free bathroom is an oil based primer. You slap on two coats in a couple hours and it is basically a shell on the walls. Yes it stinks and yes it is toxic to a point but only until it dries. You can then do whatever you want on top (oil based paint or latex primer plus paint).
It's usually not required (some areas have legacy rules that are yet to be corrected), and in my opinion it's pointless. If enough water gets through your paint that you're depending on the drywall for containment you have bigger issues. Good quality primer and paint accomplish the same thing, and if you're installing tile you probably want cementboard anyway.
I'm not surprised that the rule is on the books in some places yet. They haven't gotten around to correcting their folly.
I'll be leaving this answer up despite the downvotes. Until someone does a survey of all US jurisdictions there's no evidence that I'm wrong. Votes should not reflect anecdotal opinions.