sql server – Filter records based on other table if not empty

I have two tables. One of them represents all projects while the other one maps project ids to certain employees. If projects for a certain employee are found in that table, I need to filter the projects based on those. If no mapping is present, I want to return all projects from the projects table.

Here is what I have as of right now:

FROM Projects
WHERE Id IN (SELECT Id FROM EmployeeProjects WHERE Username = 'JDoe')

This returns all projects that are found for user JDoe in the EmployeeProjects table. However, if the following query does not return any results, I don’t want to apply the filter:

SELECT Id FROM EmployeeProjects WHERE Username = 'JDoe'

I could do it with an IF..ELSE but the query is bigger than the snippet I am showing and would mean that I would have to have the same query twice (one with and one without the WHERE statement)