Based on a definition from Wikipedia: https://en.wikipedia.org/wiki/Collation
A collation algorithm such as the Unicode collation algorithm defines an order through the process of comparing two given character strings and deciding which should come before the other. When an order has been defined in this way, a sorting algorithm can be used to put a list of any number of items into that order.
When you refer to a character, that SQL Server does not have any scene about it, then SQL Server will treat it as ?
character, therefor you will see that both
and
characters are same, because both are treated as ?
To prevent such a behaviour, you need to configure suitable collation on your database or table column or string literal.
So as @Hiran posted(https://stackoverflow.com/a/56220111/1666800) you will need to configure suitable collation.
Read more about collation in SQL Server: https://learn.microsoft.com/en-us/sql/t-sql/statements/collations?view=sql-server-2017
Here are some codes which will help you to configure the collation:
Set Collation on database:
ALTER DATABASE <Database>
COLLATE <Your Collation> ;
GO
Set Collation on Table Column:
USE <Database>
GO
ALTER TABLE <Table Nme>
ALTER COLUMN <Column Name> <Data Type>
COLLATE <Your Collation> <Other options>
GO
Set Collation on a string literal:
SELECT N'' COLLATE <Your Collation>