@Nuwan Wickramanayaka Thanks for reaching out.
Unfortunately, you cannot set the connection dynamically to the SQL connector using the connection string.
The workaround will be using the Azure AD Integrated Authentication type, if possible, as below and for every database you are using enable the Azure AD authentication for the user that you have configured in your connector.
Now you can pass the dynamic value for your server name, database name and other parameter. In my case I am using HTTP trigger to pass those values dynamically.
Feel free to get back to me if you have any queries or concerns.
Please "Accept Answer" if the answer is helpful so that it can help others in the community.