As Mr.Eduard Keilholz says use
using(SqlCommand myCommand = new SqlCommand())
{
myCommand.CommandTimeout = 60;
}
This is correct solution but before that you have to check
whether you run infinite loop
This condition occur when you run infinite for/while loop or max no of line store procedure