In a situation, the same piece of code is executed very quickly, 2~3 seconds, but it is very slow in the stored procedure and takes several minutes.
It is found that after restarting the SQL Server service, this problem can be solved
run under cmd
net stop mssqlserver
net start mssqlserver