Or, you could just run sp_help <tablename> and get all this information without any additional coding.
Note that you cannot qualify your table name with a schema name. "sp_help dbo.MyTable" will not work, but "sp_help MyTable" will work.
Also, sp_help will only look for an object in the current database.