MS SQL Server has an option called Remote Query Timeout to specify the time (in seconds), a remote operation can take before SQL Server times out. Note that, it only applies to an outgoing (not incoming) connection initiated by the Database Engine as a remote query. The default value for this option is 600 seconds, which can be configured either via SQL Server Management Studio or Transact-SQL.
Using SQL Server Management Studio:
3. In the new tab, click on Connections node.
4. In Remote Query Timeout change it to your desired value or specify 0 to set no limit.
5. Click on OK to save the changes.
Using Transact-SQL
4. Click Execute or F5.