If you’re getting an error that reads “Invalid column name ‘$action’” in SQL Server, it could be that you’re using the $action argument of the OUTPUT clause for an operation that doesn’t support this argument.
Or it could be that the operation does support the argument, but you’re referencing it with the wrong syntax.
The $action argument can only be used with MERGE operations, and it must be done correctly.
To fix this issue, be sure to only use the $action argument in MERGE operations and to reference it with the correct syntax.