A better way to remove a stuck nut is with shock loading.
If you use a large pipe (what we used to call a snipe), you are applying loads of torque which is good, but often the socket, wrench or bolt will break before the rust breaks free. This is especially true with smaller nuts like your exhaust header nuts.
I have had the best results with penetrating oil, and an air impact driver.
Lots of air pressure and a big 1/2" or larger driver that puts out lots of torque.
The rapid hammering action of the air tool on the nut has the best chance of breaking free the rust. Some times two dissimilar metals can bond togather and present an equally frustrating problem.
If a nut is in a place where heat won't melt any oil seals or anything, you can apply heat to the bolt with a torch and it will expand. Then you let it cool and it contracts, then heat it again, and cool again. Doing this several times sometimes helps free a nut.
You can apply brute force with a snipe, but know when to back off.
It may seem like a pain in the behind, but take your time.
Removing broken studs or bolts is a royal pain !
Now I'm off topic. I was referring to misc. stuck nuts on a bike.
For the drive sprocket, find a socket that fits and use a large air tool.
If you don't have one go to a shop that does.
Loosen counter-clockwise.
Good Luck, and watch for skinned knuckles.
Greg