What was the reason for changing the knock sensor???? These knock sensors rarely fail!!!!!! Any vibration in the engine will set a knock sensor code. Where there any other codes present???????
Check your IAC valve and clean.
Which engine and how many miles???