I notice that when I use the sp_executesql system stored procedure in a script, my script can't exceed 4000 characters. What's the reason for this character limitation?

The sp_executesql statement's @stmt parameter is a Unicode string. Therefore, given that the maximum string length in SQL Server 2000 is 8000 bytes (without using an ntext data type) and that each character in Unicode is 2 bytes, 4000 characters is the maximum that sp_executesql can accept.