You can use Spec conditionals in a macro. For example:

/cast [spec:1] Hammer of the Righteous; [spec:2] Crusader Strike