To get template item by template Id.
TemplateItem templateItem = Sitecore.Context.Database.GetTemplate(new ID("{11111111-1111-1111-1111-111111111111}"));
Input the name of the template to get the template by using GetTemplate Method.
TemplateItem templateItem = Sitecore.Context.Database.GetTemplate("NameOfTheTemplate");