Just include the @id and id values in your debug table.
INSERT INTO @DebugTable(
input_id,
id,
Result_On,
AlarmId,
[Target],
Result)
SELECT
@id,
id,
@AlarmStart,
@AlarmEnd,
Result_On
FROM @Results
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA