After replacing the knock sensor, you can reset the error code by disconnecting the negative battery cable for a few minutes, which will clear the PCM's memory, and the replacement sensor will work properly. If it didn't solve the problem, then you will have to clear it with the OBD-2 scan tool.