Calibrating Servo Motor
I tested your code on an Arduino Pro Mini with a Towerpro SG90 servo, and it worked perfectly. Therefore I suspect you have a fault in the wiring or power supply.

The SG90 is a small servo but quite power-hungry - even without a load it draws up to 0.75A. For my test I used a separate 4.8V battery to power the servo, ensuring that the Arduino would not be disturbed by current surges or voltage drop when the servo is operating.

If using a separate power supply doesn't help then you may have flaky wiring or a faulty servo.