Select Menu > Tools > Settings > General > Security > Phone and SIM card > PIN code.
The new code must be 4 to 8 digits long. The PIN code protects your SIM card against unauthorised use and is provided with the SIM card. After three consecutive incorrect PIN code entries, the code is blocked, and you need to use the PUK code to unblock it before you can use the SIM card again.
Contact your service provider (operator) if you do not know the PUK code.
Applies for example the following Nokia devices: E51, E63, E66 and E71.