Depends on the magnitude of the glitch. However, I know of no mistaken code that can mess up a game's very memory to such levels. Which means that, most of the time, wiping out the current save file (Select+Up+B in the intro.) will be more than enough to clear off any glitch the game might have had. It happened in my Ruby once. Erasing the file fixed it.
at the title screen use up + select + B (i think it was)
that is supposed to completely reset it to the original factory settings
and let this be a lesson that no matter what cheating device you use... cheating is BAD