It depends upon the type and style of head(pop up spray or ratchet type). Grab the cap of the pop up spray head and unscrew it,(it is spring loaded so be prepared, or grab the end of the spray nozzle in the middle of the head and pull up, or dig down around the spray head to see how long it is (4" or 6") for a spray head and the cans for the ratchet type are bigger. On the spray type head, see if you have the quarter round, half round, full circle, rectangular, half rectangular, or 360 degree adjustable. The nozzle is replaceable if it is broken. If the whole cap is broken then replace the whole thing.
Go to a store that carries them and buy a replacement. Sometimes you can get parts for the spray heads but I've found that they have a gasket around the part that pops up and it may leak anyway with a replacement part. Just unscrew the cap of the old one and replace it with the new cap, spring, and nozzle assembly(usually the outside can of the spray head is ok and doesn't need replacing. Turn the nozzle to match where it should spray. If you replace the whole thing, then keep dirt out of the hole. Sometimes you have to dig the hole out to replace them. The cans require a screwdriver to raise the lid up to view the ratchet assembly and you may have trouble getting a grip on the nozzle of the spray head. The ratchet type have a special tool for removing them from the can. It is also handy to have an easy out tool for removing nipples, etc. that break off under the cans (sold with the rainbird supplies).
I typed the above and realized you were talking about the pop up type spray head and not the ratchet type so disregard the part about that. At the store, just unscrew the cap off of one and you will see all you need to know about them. Buy extras cause it will happen again. I usually just buy the adjustable ones.