If they aren't going back in again, you could just use mole grips.
Two nuts will often work.
The proper tool would be a stud extractor. I use the type with tapered rollers in a socket. They can cause a bit of galling on the stud though. They can damage a threaded section quite badly but I find if you're using them on a plain stud section, it's nothing a bit of a rub with some emery paper wont fix. I slide them as close to the bottom of the stud as possible and put a spanner on them instead of using a ratchet handpiece to reduce the chance of shearing the stud. In this case, a ratchet spanner in use, Posing for the photo, I slide it nearer the bottom for actually extracting the stud.
A set of stud extractors is one of those little tools you don't use very often but that doesn't cost much and gives a warm sense of satisfaction when you can pull it out of the cupboard of "special" tools and use it. Mine were about £20 from machine mart as I recall, 6,8,10 and 12mm. I've used them more often for removing exhaust studs from Japanese bikes.
Of course, if you're replacing them with our hosts ones with the square end, you can wind them in and out using a reversed 1/4" drive socket and an allen key.
If it's a classic engine, remember to run a drill through the cylinder head washers before re-fitting them. Even with the hardened ones, they can land up VERY stuck as I found recently taking the head off my 350.