A support specialist asks for a few rows from the production database to investigate a customer complaint. They need the order number and date to solve it; they do not need the customer's national ID, phone or card details. Data masking is the name for giving the data the job requires and hiding what it does not. This article explains the types and techniques of masking, how it differs from encryption and anonymisation, and what it means under KVKK, the Turkish data protection law.

What Is Data Masking?

Data masking replaces a sensitive value with one that keeps its format but does not reveal the real value. 123******01 is shown instead of 12345678901, a***@example.com instead of ayse@example.com. The record stays usable; sorting, counting and matching are often still possible, but the person looking at it does not reach the real personal data.

Three Types: Static, Dynamic, Result Masking

"Data masking" is not a single technique; there are three approaches depending on where and when the masking happens. Which one you need depends on who receives the data and how.

Type When and where Typical use Limit
Static masking A copy of the data is taken and its values are changed permanently Preparing test and development environments The copy process itself touches production data; the copy goes stale
Dynamic masking Data stays in place; query results come back masked according to permission Application screens, reporting users A user who can write queries can infer values; it does not protect against privileged users
Result masking A query result taken from production is masked per column before delivery One-off data requests for support, analysis and audit Does not control where the file goes after delivery

What SQL Server's built-in dynamic data masking does not tell an auditor is covered in detail in the limits of dynamic data masking.

Masking Techniques

  • Partial redaction: part of the value stays visible and the rest is starred: 5312 **** **** 4410. Enough for a support team to recognise the record.
  • Fixed value: the whole value is replaced with the same text: [HIDDEN]. The safest choice when the column is not needed.
  • Substitution: a real name is replaced with a realistic but fake one. Used for test data.
  • Shuffling: values in a column are swapped between rows; the distribution is kept and the link is broken.
  • Date shifting: values such as dates of birth are shifted within a range; the age band is kept.
  • Hashing: the value is replaced with a one-way digest; because the same value gives the same digest everywhere, tables can still be joined. On short, guessable values (such as ID numbers) it is not enough on its own, because the value can be recovered by trying candidates.

How It Differs from Encryption and Anonymisation

The three concepts are often confused. Encryption makes data unreadable to anyone without the key; whoever has the key gets the real value back. Even if the database is encrypted on disk, an authorised query sees the clear value. Masking changes the value that is shown; the goal is never to hand over the real value. Anonymisation means the data can no longer be linked to a specific person, even when combined with other data.

The important consequence: masking one column does not make the record anonymous by itself. A row with the ID number hidden but the name, date of birth and district in clear often still points to a specific person and is still personal data. The masking decision should look at what the columns of the result show together, not at one column.

Data Masking and KVKK

The law requires the data controller to take measures that provide an appropriate level of security to prevent unlawful access to personal data. Masking is one of those measures: it narrows access for everyone who needs production data but does not need to see personal data. The Board's guidance sets limiting access to need and not processing more personal data than necessary as principles; masking is how that principle is applied in the database.

What an audit asks, though, is not whether masking exists but how the decision was made: which column was masked and why, which was left in clear and why, and who approved leaving it in clear? A method that answers these questions is in how the masking decision is made.

How to Implement Data Masking

  1. Find sensitive columns: scan by column name (national ID, phone, e-mail, IBAN) and by content (valid ID numbers, card numbers). Names alone are not enough; an ID number can sit in a column called "Notes".
  2. Choose a technique: decide the technique for each column type; a fixed value where the column is not needed, partial redaction where it must be recognised.
  3. Make masked the default: seeing a value in clear should be the exception and should need a justification and an approval.
  4. Secure delivery: results should go encrypted and openable only by the approved recipient, not as an e-mail attachment.
  5. Record it: which column was masked and why, and who saw what in clear, should be kept for every request.

SQL Change Guard applies result masking to data requests from production: columns are previewed from the schema without reading data, sensitive ones are found and masked using name patterns and content validators (ID number, card, IBAN), a column requested unmasked needs a justification and an approval, and the result goes to the approved recipient in a password protected, encrypted package. The product does not prepare test databases; if static masking is needed, that job is done with a separate tool.

Frequently Asked Questions

Is data masking the same as encryption?

No. With encryption, whoever has the key gets the real value back; with masking, the value shown never carries the real value. They are used together, not instead of each other.

Is masked data still personal data?

Often, yes. If together with the other columns of the record it still points to a specific person, it is personal data. For it to stop being personal data it has to become anonymous, meaning it can no longer be linked to a person in any way.

How is data masking done in SQL Server?

SQL Server offers dynamic masking by adding a definition such as MASKED WITH (FUNCTION = 'partial(...)') to a column; a user without the UNMASK permission sees the masked value. This does not cover privileged users or inference by a user who can write queries directly.

Is masking enough to use real data in test?

Test needs static masking, and the columns together must not identify the person. The risks are covered in real data in test environments.

Run production data requests masked and recorded

We will show the steps of a data request, from column preview to encrypted delivery, on your own schema.

Book a Demo →