Crap, I wrote a big reply about how to go about updating the name tables in a scrolling game, and only after posting I realized this was NES
emdev, not NESdev!
Since I'm here already, I'll try and give a fitting answer: basically, you should simulate the PPU's fetching pattern. For each tile rendered, the PPU reads a name table byte and an attribute table byte (plus 2 pattern table bytes, but those are not relevant to the matter). The addresses used for reading these bytes are calculated based on internal counters, which automatically wrap around. So as long as you update these counters the same way the PPU does, and make the same memory fetches as the PPU does, wrapping will work just fine.
Pre-rendering backgrounds is not a good idea, because the CPU can modify PPU registers and memory as the image is being rendered, which can affect how the image looks. This means that not always what would normally be the same background section will look the same, because a lot of things can change between both instances of the same background section (palette, color emphasis, scroll, etc).
Please refer to
this wiki page to understand the order in which the PPU does things during rendering. The closest you adhere to this pattern, the more accurate your emulator will be.