It sounds like there are dependency issues relating to the "msodbcsql17" package. There are many possible scenarios as to how the dependency issue could have occurred. A solution that will work in most cases is uninstalling and reinstalling Homebrew. This will ensure that Homebrew is installed at the correct location for the type of Mac you're on (Apple Silicone vs Intel) and any dependency issues will be fixed.
First step is to take note of the currently installed brew packages by running:
brew list
You should see a list similar to this (yours will have different packages listed):
Take a screenshot of the returned list so you know what needs to be reinstalled (as removing Homebrew will also remove all of the installed packages).
Then run this command to download the Homebrew removal script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Run the uninstaller:
/bin/bash uninstall.sh
Take note of any folders the uninstaller indicates will need to be removed manually. Go ahead and remove those folders too.
Now reinstall Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Note the instructions once the install completes - you need to run two commands to add brew to the PATH.
From there, reinstall the packages that were displayed from from the 'brew list' command previously.
To reinstall the SQL Server drivers, run:
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
brew install autoconf automake libtool
brew install msodbcsql17 mssql-tools
brew install unixodbc
Intel Mac
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
Apple Silicone Mac
sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install sqlsrv
sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install pdo_sqlsrv
And one final command to fix an issue on Apple Silicone Macs:
ln -sfn /opt/homebrew/Cellar/openssl@1.1/1.1.1m /opt/homebrew/opt/openssl