>> In SQL Server 2005 Enterprise, I can change the CPU affinity via
>> Management Studio. Is there a way that I can change these settings via
>> t-sql?
See the system procedure sp_configure in SQL Server Books Online.
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/9f38eba6-39b1-4f1d-ba24-ee4f7e2bc969.htm