I found an answer! The only thing I need to do is to override method that checks if my template can be applied to any UML element. I added the next code to my t4 template file to check that stereotype "auxiliary" is applied to the class:
<#+
protected override bool AppliesToElement()
{
bool isTemplate = this.Element.IsTemplate;
bool isBoundElement = this.Element.TemplateBindings != null && this.Element.TemplateBindings.Any();
return !isTemplate && !isBoundElement && GetStereotype(this.Element) == "class"
&& this.Element.AppliedStereotypes.Any(s=>s.Name == "auxiliary");
}
#>