Replacing a code in various pages at same time – HTML

I have a lot of pages of code on a site and one of this has a problem. I’d like to past and replace the code to another, but without having to go through each of the hundreds of pages. How can I do this? Many thanks!