Without any example tables, data, and desired results, here is my attempt at a solution using output
and a table variable.
create table t (id int not null identity(1,1), val varchar(32), audit_id int null);
insert into t (val) values ('three'),('two'),('one');
create table audit (id int not null identity(1,1), val varchar(32));
/* table variable for output */
declare @output table (id int, val varchar(32));
/* insert with output */
insert into audit (val)
output inserted.id, inserted.val into @output
select val
from t;
/* updated t from output */
update t
set audit_id = o.id
from t
inner join @output o
on t.val = o.val;
select * from audit;
select * from t;
rextester demo: http://rextester.com/JMOT34416
for the audit
table, returns:
+----+-------+
| id | val |
+----+-------+
| 1 | three |
| 2 | two |
| 3 | one |
+----+-------+
and for the temporary table t
+----+-------+----------+
| id | val | audit_id |
+----+-------+----------+
| 1 | three | 1 |
| 2 | two | 2 |
| 3 | one | 3 |
+----+-------+----------+