Here is an alternative using the INFORMATION_SCHEMA view.
select column_name
from information_schema.table_constraints join information_schema.key_column_usage on (information_schema.table_constraints.constraint_name = information_schema.key_column_usage.constraint_name)
whereinformation_schema.table_constraints.table_name = @table_name
and constraint_type = 'PRIMARY KEY'