That depends.

16F's can NOT read the serial number at Run-Time.
They can only be read by an ICSP Programmer.

18F's CAN read the numbers at run-time.

If you have PBP2.50, it can be read with READCODE.
If you have a prior version of PBP, you can use this ...

Run-Time Config
http://www.picbasic.co.uk/forum/showthread.php?t=4093
<br>