So,...I'm still a little confused by the way that you are wording this problem.
Code Protection prevents others from reading the chip after it has been programmed. It has no effect on writing.
By default all of my hex files have code protection added. That's to make sure if you sell a mod to someone they don't rip off your hex file.
...but I want to say that you can overwrite that default setting when you are in PICKit 2's software.
Try hitting "Ctrl+P".
If that doesn't help, then maybe a screenshot of the error you are getting?