Is it possible to add dynamic conditons for templates

CleanShot 2024-12-06 at 20.32.34

Is it possible to add this kind of conditions on templates? I want to hide/show the header template if I have a custom field with some value.

I know it is possible to hide all elements indivitualy on the template, but for some reasons I want to add this dynamic conditions on templates.

Thank you