You can only do it if the PIC itself can control the power, for example if your application has a power button or 'standby' button that lets the software turn the power on and off. If it has that ability, all you have to do when turning off is check the EE staus register to see if a write operation is still in progress and delay the turning off until it says it's safe to do so. If you power switch just kills the supply by disconnecting the source there isn't much you can do. Some things might help though:
1. enable the power-up reset timer timer. This will ensure the PIC has had time to sort it's insides out before releasing the reset line.
2. enable the BOR circuit to protect against out-of-spec supply voltages. These may arise during the switching on and off times.
3. when writing to the EEPROM, check the WRERR bit to ensure the write cycle completed sucessfully. Repeat it if an error is detected.
4. disable interrupts (use GIE) during the EEPROM write cycles in case an interrupt breaks the write unlocking sequence.
5. reserve a 'parking address' in EEPROM which isn't used for anything else and after each write operation, set the EEADR register to the parking address.
Electrically, it is theoretically possible to corrupt the memory if VPP is applied during normal operation although it's highly unlikely. If you don't have one at the moment, add a capacitor (100nF) from VPP to VSS to prevent interference accidentaly putting the PIC in programming mode.
Brian.