This isn't exactly encrypting. What you are wanting to do is enforce a particular format for data consitancy. That would be done through a field constraint by passing the information between your front end application and then validates against the data field constraint and returns a value if the constraint is not met.
The Check constraint would look something like .....
CONSTRAINT user_password CHECK (password LIKE
'[A-Z][A-Z][A-Z][1-9][0-9][0-9][0-9][0-9][a-z]' OR
emp_id LIKE '[A-Z]-[A-Z][1-9][0-9][0-9][0-9][0-9][a-z]')
Here is the information about constraints from Books Online:
Constraints allow you to define the way Microsoft® SQL Server™ 2000 automatically enforces the integrity of a database. Constraints define rules regarding the values allowed in columns and are the standard mechanism for enforcing integrity. Using constraints is preferred to using triggers, rules, and defaults. The query optimizer also uses constraint definitions to build high-performance query execution plans.
Classes of Constraints
SQL Server 2000 supports five classes of constraints.
NOT NULL specifies that the column does not accept NULL values.
CHECK constraints enforce domain integrity by limiting the values that can be placed in a column.
A CHECK constraint specifies a Boolean (evaluates to TRUE or FALSE) search condition that is applied to all values entered for the column; all values that do not evaluate to TRUE are rejected. You can specify multiple CHECK constraints for each column. This sample shows the creation of a named constraint, chk_id, that further enforces the domain of the primary key by ensuring that only numbers within a specified range are entered for the key.
CREATE TABLE cust_sample
(
cust_id int PRIMARY KEY,
cust_name char(50),
cust_address char(50),
cust_credit_limit money,
CONSTRAINT chk_id CHECK (cust_id BETWEEN 0 and 10000 )
)
Good luck!!