This problem mostly occur when you update your phone via computer and the phone gets locked , iPhone turns into iBrick and the only way I know to get rid of this problem is to insert a sim card of that carrier by which your phone is locked .
What if that carrier has no service in your area ! Then just simply connect to a wifi hot spot and you are done !!!
Now you can pull out the sim card if you want .
;)