I remember inputting cheat codes in the music test for Super Sonic anytime in Sonic 2 , but I remember there was either a way or a cheat code to get "Hyper Sonic". Does anyone remember?
"Run forward in Oil Ocean, Act 2 until reaching the green jet springs. Jump on the very last spring and hold Right. Sonic will hit a group of spikes before becoming stuck in the side of the wall. Jump out to transform into Hyper Sonic. In this mode, Sonic can run faster and jump farther than Super Sonic, but is not invincible."
Here is a YouTube video showing the glitch:
No, there is no code for Hyper Sonic in Sonic 2. Hyper Sonic was an exclusive feature of Sonic 3 and Knuckles (requiring the locked-on combination of the two cartridges). The code given in Mana's answer gives the player a more powerful version of Super Sonic through a bug (which is probably what the asker was enquiring about), but this is not Hyper Sonic.
This character [Hyper Sonic] was only available in Sonic 3 & Knuckles and has not been in any game since.
First, head to the Options menu from the title screen, and then into the Sound Select menu from there. Play the following sounds in this order:
19 65 09 17
After that, press the C button and then Start. You will be taken back to the title screen. Now, when you see Sonic and Tails (Mils) appear on the screen, press and hold A and press Start while holding A to be taken to the Level Select menu.
From this menu, enter the Sound Test feature, and play the following sounds in this order:
04 01 02 06
If done correctly, you will hear a familiar tune, confirming the Super Sonic code was done correctly. Exit this menu and start the game as normal. Once you collect a minumu of 50 coins in any level, Jump (Press A) to activate the Super Sonic code.
Use debug mode in the cannons before the cannon fires then you should see you moving automatically then exit debug mode (Do it as super sonic)