Hi Deepak,
I am not exactly clear on what you are trying to say but here goes anyway.
Pin 2 is shared with then BKGD function.
This is enabled out of power up.
To use this pin as GPIO you disable this function by clearing 1,SOPT1 which you are doing.
But, this is a write once register, make sure the write you are showing us here is the only one that occurs.
Only the first write to this register is honoured!
Maybe this is your problem. If not please try again to explain your problem.