I am trying to execute this query and the message is appearing that @NomeMaquina is not declared, could someone help me? I do not know what is missing
Query
ALTER PROC [dbo].[ProObterProxCasoProcessamento]
@IdProcesso INT,
@nomeMaquina varchar(50)
AS
BEGIN
DECLARE @IdCaso INT
--REALIZA A CONSULTA PELO PRÓXIMO CASO DISPONÍVEL
SELECT TOP 1
@IdCaso = spc.IdCaso
FROM
statusprocessoscaso spc
WHERE
(
spc.IdStatus = 1
OR
(
spc.IdStatus = 2
AND
spc.DataAlteracao < DATEADD(MINUTE, -20, GETDATE())
)
OR
(
spc.IdStatus = 6
AND
spc.DataAlteracao < DATEADD(MINUTE, -20, GETDATE())
)
)
AND
spc.IdProcesso=@IdProcesso
--ATUALIZA O CONTROLE DO PROCESSAMENTO
UPDATE statusprocessoscaso
SET IdStatus = 2, DataAlteracao = GETDATE(), Mensagem = 'Caso está sendo executado',NomeMaquina = @nomeMaquina
WHERE IdCaso= @IdCaso
SELECT @IdCaso
END