Your son needs a MAD place.
The biggest problem at two is that he cannot express himself with words, so he throws things to express himself. Does this make sense? Your son is angry and frustrated and cannot say, "I'm feeling angry!" If you punish him, all you are doing is reinforcing that it is not OK for him to be angry.
Provide your son with a safe place to throw things. Call this his MAD place. Take him there (gently and lovingly) when he throws something and encourage him to pick up the safe toys to throw at the safe wall in his MAD place. Then give him words to use while he throws things:
"I'm mad that I can't have ice cream!" "I'm mad that I have to sit down at dinner!"
If he is verbal, you can ask him what he is mad about and then encourage him to yell about it while he throws things.
As the future unfolds, this MAD place becomes the only place allowed for him to throw things so that he gets the difference between disrespectfully throwing things and respectfully throwing things.
NEVER use this place as a time out place. If he starts to get mad or act out, just ask him if he wouldn't like to go to his MAD place and let the wall know how mad he is. If he doesn't want to go there, he will have to have his feelings without disrupting everyone else.
Now he has a choice: he can have his feelings calmly in public, or he can go to his mad room and yell and throw things until he feels better. Either way, he is learning to manage his feelings.
Now, get ready for the equally terrible THREE'S!