Use the sp_configure 'optimization goal' parameter to set a goal to apply server wide. The syntax is:
sp_configure 'optimization goal',1,'goal_name'
For example, to set the goal_1571 for the server, enter:
sp_configure 'goal',1,'goal_1571'
Use set to set the goal for the current session or server-wide. The syntax is:
set plan optgoal goal_name
For example, to set goal_1571 for the current session:
set plan optgoal goal_1571
This example uses goal_name in an abstract plan at the query level:
select count(*) from tab1,tab2 PLAN '(use optgoal goal_1571)' go