You may want to look at some of Peter Kahrel's scripts, found here: Dynamic endnotes, column notes, margin notes | Peter Kahrel. He provides some methods for making endnotes dynamic, for instance, that could be useful.
If you want to do it yourself, it depends on how your book is set up. Do you number notes straight through (moderately straightforward to script), or by section (much less straightforward to script)? Do you use distinct styles for your note markers in the text and your note numbers in the note itself?
Another option might be to export to IDML and renumber in the XML, then reimport; it really depends on where you're comfortable automating (InDesign via script or XML via text editor).