You will need to trace the wiring for the CPS sensor in greater detail...the wiring for the KJs tends to go all around the engine bay....does not take the shortest route point to point!
This means that the leads for the CPS sensor will go through several connectors and several places where the insulation wears down and the copper touches chassis occasionally.
First disconnect the battery and check the connectors on the PCM...re-plug the connectors a few times to clean the contacts off.
Then go through the wiring diagrams to see where the relevant wires goes through connectors and re-plug those connectors. The wiring diagrams have a section that shows where the connectors are located.
Worse case scenario is that you need to unplug the sensor and the corresponding PCM connector and then with a digital multi meter set to Ohms trace each wiring for continuity from point to point while shaking the connectors and harness around to see if you lose contact. Also with both ends of the wire disconnected check for leakage to chassis with your meter as you shake the wiring around....should be infinite resistance!
The trouble with the wiring is that it usually becomes part of a thick harness with other wires and somewhere along the way your relevant wires could rub through onto other random wires....I had about 7 occurances of this happening on my 2002 Export CRD after a front end collision caused damage to the harness under the radiator. The only way to fix these problems was to cut off both ends of the suspect wire...including cutting off any splices....so that the wiring was completely isolated. Then I would replace the wiring with new sections while taking the shortest point to point route.
If you do not have the 2002 KJ Wiring diagrams download the 2002 KJ Service Manual here...I will have a look through them as well.
Service manuals:
Index of /manuals/Jeep/KJ
Update: Having a quick look at page 8Wa-30-9 of the 2002 KJ Service Manual...the Camshaft Position Sensor has a Tan/Yellow wire going from pin 3 of the CPS sensor through to pin 18 of Connector C1 on the PCM. This wire goes via connector C110...use the Connector Location section to find this connector C110 and re-plug it.
C101 supplies ground to this sensor via a Black/Light Blue wire but this also supplies the Crankshaft Position Sensor so if this was faulty you should expect CEL codes for this sensor as well.
Unfortunately lots of splices in the circuitry but these are common once again to the Crank sensor so unlikely the fault is in this area.
With battery disconnected and Cam Sensor unplugged and PCM connector C1 unplugged the Tan/Yellow wire should show good connectivity end to end and no leakage to chassis/engine. If this is not the case then you need to cut both ends of this Tan/Yellow wire off and replace it with a new wire going direct from the Cam sensor to the PCM connector C1 pin 18 position.