Sql Server Brute Force Attack
I've never attempted to block traffic at the SQL Server level.  In my experience that is handled via a hardware firewall, Windows Firewall, or both.  I find it interesting that you allow connections to SQL from unknown IP addresses.  I would focus creating a white list of valid, known IP addresses and block everything else as others suggested.

To answer your question:  I did some searching and here is a linked response on writing a SQL query used as a SQL Agent job to block traffic after X number of failed login attempts.  StackOverflow Answer