Pipeline based on specific branch?

We would like to have a pipeline which builds no matter which branch is checked into git and have custom logic in the script based on the branch name such as getting access to the ${env.BRANCH_NAME} variable.

I’ve setup a multi branch pipeline how ever it seems to run multiple builds for all the branches in the pipeline where as I would want to see just 1 build run and it to use the Jenkinsfile in that specific branch of the git project.