Already tried in WordPress to check if a category exists? There is no Template Tag so you need to create your own solution.
I have 3 different solutions prepared, although one solution only works within the framework of the admin area.
The individual solutions are not explained in depth but surely understandable if you read the code. Alternatively, you can also create a custom function and then use it, like a separate Template Tag for the theme. Therefore put this function in the
functions.php of the theme.
In order to understand the code, I have as an example either the category called „Uncategorized“ , or the ID 1. These values must of course be adjusted to your theme.