What is the best DIY way to remove an iron railing from cement and reinstall it? if I cut the rail I'll need to patch it and use brackets to reinstall it. If I drill out next to the post in the cement and reinstall the railing, I'll need new cement.
You have two options, but neither, unfortunately, is DIY-friendly. They both require professional skill and expertise to accomplish, and accomplish well.
The best way to remove and replace the railing is to do so in the way it was initially installed. Generally, railings are not welded in place. If the post is in concrete, you can drill with masonry drill around the post to clear out some of the setting material. This will loosen the rail and you can pull out - but then, yes, the masonry needs to be repaired by a pro.
If that's not possible and you need to cut the railing itself, it could be cut strategically and re-welded. Again, a job for a pro.