Can also be wiring related, so check out the connections, and look for broken wires before parting with cash.
Knock sensor is easy to change if you need to - they are both on the face of the block.
Make sure you do them up to the correct torque - 20 nm rings a bell but don't quote me on that.