I found this snip on Microchip website
Code:
	// read serial number from PIC ID memory at address 0x200000 - 0x200007
	DWORD ReadIDMemory(void) {
	DWORD IdMemory=0;
	DWORD Temp;
	BYTE i;
	TBLPTR = (unsigned short long) 0x200000;

	for(i=0;i<8;i++) {
		_asm
		TBLRDPOSTINC
		_endasm
		Temp=TABLAT;
		Temp<<=((7-i)*4);
		 IdMemory+=Temp;
		}
	
	return IdMemory;
}